<template>
<div class="box">
{{currentDate}}
</div>
</template>

<script lang="ts" setup>

const formatDate = (  ) => {
  // 格式化日期，获取今天的日期
  const Dates = new Date( new Date().getTime() );
  const year: number = Dates.getFullYear();
  const month: any = ( Dates.getMonth() + 1 ) < 10 ? '0' + ( Dates.getMonth() + 1 ) : ( Dates.getMonth() + 1 );
  const day: any = Dates.getDate() < 10 ? '0' + Dates.getDate() : Dates.getDate();
  return year + '-' + month + '-' + day;
};

const currentDate=formatDate()
console.log(currentDate)
</script>

<style lang="less" scoped>
.box{
  -webkit-app-region:no-drag;  //禁止可拖拽，不然会失焦点

  margin-top: 5px;
  width: 220px;
  height: 30px;
  border-radius: 5px;
  opacity: 0.8;
  padding: 0 5px;
  color: white;
  display: flex;
  align-items: center;

  background:rgba(255,255,255,0.3);
}
</style>